//
//  MANetwork.h
//  meiang_edu
//
//  Created by 李国栋 on 2018/10/19.
//  Copyright © 2018年 com.meiang.meiang_edu. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef void(^MASuccessBlock)(id response,BOOL success);
typedef void(^MAFailBlock)(NSError *error);

@interface MANetwork : NSObject

/**
 GET请求

 @param URLString url
 @param parameters 参数
 @param autoAlert 如果请求失败,是否自动展示提示
 @param showLoading 是否展示加载中浮层
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)GET:(NSString *)URLString parameters:(nullable NSDictionary *)parameters autoShowFailAlert:(BOOL)autoAlert showLoading:(BOOL)showLoading success:(MASuccessBlock)success failure:(MAFailBlock)failure;

/**
 PST请求
 
 @param URLString url
 @param parameters Body参数
 @param autoAlert 如果请求失败,是否自动展示提示
 @param showLoading 是否展示加载中浮层
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)POST:(NSString *)URLString parameters:(nullable NSDictionary *)parameters autoShowFailAlert:(BOOL)autoAlert showLoading:(BOOL)showLoading success:(MASuccessBlock)success failure:(MAFailBlock)failure;

/**
 PST请求
 
 @param URLString url
 @param bodyString bodyString参数
 @param autoAlert 如果请求失败,是否自动展示提示
 @param showLoading 是否展示加载中浮层
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)POSTString:(NSString *)URLString bodyString:(nullable NSString *)bodyString autoShowFailAlert:(BOOL)autoAlert showLoading:(BOOL)showLoading success:(MASuccessBlock)success failure:(MAFailBlock)failure;

@end
